package io.kiki.stack.netty.util;

import io.netty.util.HashedWheelTimer;
import io.netty.util.Timer;

import java.util.concurrent.TimeUnit;

public class TimerHolder {

    private final static long defaultTickDuration = 10;

    private TimerHolder() {
    }


    public static Timer getTimer() {
        return DefaultInstance.INSTANCE;
    }

    private static class DefaultInstance {
        static final Timer INSTANCE = new HashedWheelTimer(new NamedThreadFactory("DefaultTimer", true), defaultTickDuration, TimeUnit.MILLISECONDS);
    }
}